FROM ubuntu:14.04
MAINTAINER "xiaochun" <xchun90@163.com>

RUN apt-get update && apt-get -y install wget git
RUN mkdir -p /root/dev && mkdir -p /root/app/
RUN cd /root/dev && wget http://apache.fayea.com/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz && tar -xvf apache-maven-3.3.3-bin.tar.gz
RUN cd /root/dev && wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz && tar -xvf jdk-8u45-linux-x64.tar.gz

#SET PATH
ENV PATH=/root/dev/apache-maven-3.3.3/bin:/root/dev/jdk1.8.0_45/bin:$PATH
ENV JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8

#Build
ADD bin/docker-build.sh /root/app/docker-build.sh
RUN cd /root/app/ && sh docker-build.sh
RUN rm /root/dev/apache-maven-3.3.3-bin.tar.gz && rm /root/dev/jdk-8u45-linux-x64.tar.gz

EXPOSE 80
ADD bin/docker-run.sh /root/app/docker-run.sh
ADD conf/conf.properties /root/app/zrlog-simple/blog-web/conf/conf.properties
RUN chmod a+x /root/app/docker-run.sh
CMD /root/app/docker-run.sh